<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org" lang="en">
	<head>
		<meta charset="utf-8" />
		<title>Seguros</title>

		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta name="description" content="" />
		<meta name="author" content="" />

		<!-- basic styles -->

		<script src="../../static/jquery/jquery.min.js" th:src="@{/static/jquery/jquery-2.0.3.min.js}"></script>
		<link href="../../static/bootstrap/css/bootstrap.min.css" th:href="@{/static/bootstrap/css/bootstrap.min.css}" rel="stylesheet" />
		<script src="../../static/bootstrap/js/bootstrap.min.js" th:src="@{/static/bootstrap/js/bootstrap.min.js}"></script>
		<link href="../../static/font-awesome/css/font-awesome.min.css" th:href="@{/static/font-awesome/css/font-awesome.min.css}" rel="stylesheet" />			

		<link href="../../static/jquery/jquery-ui.css" th:href="@{/static/jquery/jquery-ui.css}" rel="stylesheet" />
		<script src="../../static/jquery/jquery-ui.js" th:src="@{/static/jquery/jquery-ui.js}"></script>
		
		<link href="../../static/custom/datepicker.css" th:href="@{/static/custom/datepicker.css}" rel="stylesheet" />		
		<!-- fonts -->

		<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" th:href="@{'http://fonts.googleapis.com/css?family=Open+Sans:400,300'}" rel="stylesheet" />

		<!-- ace styles -->

		<link href="../../static/custom/ace.min.css" th:href="@{/static/custom/ace.min.css}" rel="stylesheet" />
		<link href="../../static/custom/ace-rtl.min.css" th:href="@{/static/custom/ace-rtl.min.css}" rel="stylesheet" />
		<link href="../../static/custom/ace-skins.min.css" th:href="@{/static/custom/ace-skins.min.css}" rel="stylesheet" />

		<!--[if lte IE 8]>
		  <link href="../../static/custom/ace.min.css" th:href="@{/static/custom/ace-ie.min.css}" rel="stylesheet" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->

		<script src="../../static/custom/ace-extra.min.js" th:src="@{/static/custom/ace-extra.min.js}"></script>

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

		<!--[if lt IE 9]>
		<script src="../../static/custom/html5shiv.js" th:src="@{/static/custom/html5shiv.js}"></script>
		<script src="../../static/custom/respond.min.js" th:src="@{/static/custom/respond.min.js}"></script>
		<![endif]-->
	</head>

	<body>
		<div class="navbar navbar-default" id="navbar">
			<script type="text/javascript">
				try{ace.settings.check('navbar' , 'fixed')}catch(e){}
			</script>

			<div class="navbar-container" id="navbar-container">
				<div class="navbar-header pull-left">
					<a href="#" class="navbar-brand">
						<small>
							<i class="fa fa-suitcase"></i>
							Open Bank Lite
						</small>
					</a><!-- /.brand -->
				</div><!-- /.navbar-header -->

				<div class="navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						<li class="light-blue" th:if="${#authentication}">
							<a data-toggle="dropdown" href="#" class="dropdown-toggle">
								<img class="nav-user-photo" src="../../static/images/business_user.png" th:src="@{/resources/static/images/business_user.png}" alt="Foto" />
								<span class="user-info">
									<small>Bienvenido,</small>
									<span sec:authentication="name">Miguel</span>
								</span>

								<i class="fa fa-caret-down"></i>
							</a>

							<ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<li>
									<a href="#">
										<i class="fa fa-cog"></i>
										Opciones
									</a>
								</li>

								<li class="divider"></li>

								<li>
									<a href="#" th:href="@{/logout}">
										<i class="fa fa-power-off"></i>
										Cerrar Sesi&oacute;n
									</a>
								</li>
							</ul>
						</li>
					</ul><!-- /.ace-nav -->
				</div><!-- /.navbar-header -->
			</div><!-- /.container -->
		</div>

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				<div class="sidebar" id="sidebar">
					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
					</script>

					<ul class="nav nav-list">
						

						<li>
							<a href="#" class="dropdown-toggle">
								<i class="fa fa-money"></i>
								<span class="menu-text"> Finanzas</span>

								<b class="arrow fa fa-angle-down"></b>
							</a>

							<ul class="submenu">
								<li>
									<a href='/mantenerCaja' th:href="@{/mantenerCaja}">
										<i class="fa fa-angle-double-right"></i>
										Cajas
									</a>
								</li>

								<li>
									<a href="#" title="Funcionalidad por implementar">
										<i class="fa fa-angle-double-right"></i>
										<span class="text-muted">Cuenta Efectivo</span>
									</a>
								</li>

								<li>
									<a href="#" title="Funcionalidad por implementar">
										<i class="fa fa-angle-double-right"></i>
										<span class="text-muted">Dep&oacute;sito a Plazo</span>
									</a>
								</li>

								<li>
									<a href="#" title="Funcionalidad por implementar">
										<i class="fa fa-angle-double-right"></i>
										<span class="text-muted">Pr&eacute;stamos</span>
									</a>
								</li>

								<li>
									<a href="#" title="Funcionalidad por implementar">
										<i class="fa fa-angle-double-right"></i>
										<span class="text-muted">Cobranza Diaria</span>
									</a>
								</li>

								
							</ul>
						</li>
						<li class="disabled">
							<a href="#" class="dropdown-toggle" title="Funcionalidad por implementar">
								<i class="fa fa-users"></i>
								<span class="menu-text"> Socios </span>

								<b class="arrow fa fa-angle-down"></b>
							</a>
							<ul class="submenu">
								<li>
									<a href="#" title="Funcionalidad por implementar">
										<i class="fa fa-angle-double-right"></i>
										<span class="text-muted">Administraci&oacute;n de Socios</span>
									</a>
								</li>
								<li>
									<a href="#" title="Funcionalidad por implementar">
										<i class="fa fa-angle-double-right"></i>
										<span class="text-muted">Atenci&oacute;n al Socio</span>
									</a>
								</li>
								<li>
									<a href="#" title="Funcionalidad por implementar">
										<i class="fa fa-angle-double-right"></i>
										<span class="text-muted">Banca Electr&oacute;nica</span>
									</a>
								</li>																
							</ul>
						</li>
						<li class="disabled">
							<a href="#" title="Funcionalidad por implementar">
								<i class="fa fa-dashboard"></i>
								<span class="menu-text"> Gerencial </span>

							</a>
						</li>
						<li class="disabled" title="Funcionalidad por implementar">
							<a href="#">
								<i class="fa fa-building-o"></i>
								<span class="menu-text"> Bancos </span>

							</a>
						</li>
						<li class="active open">
							<a href="#" class="dropdown-toggle" >
								<i class="fa fa-book"></i>
								<span class="menu-text"> Contabilidad </span>

								<b class="arrow fa fa-angle-down"></b>
							</a>

							<ul class="submenu">
								<li class="active">
									<a href='/mantenerTipoCambio' th:href="@{/mantenerTipoCambio}">
										<i class="fa fa-angle-double-right"></i>
										Tipos de Cambio
									</a>
								</li>								
							</ul>
						</li>
						<li class="disabled">
							<a href="#" class="dropdown-toggle" title="Funcionalidad por implementar">
								<i class="fa fa-edit"></i>
								<span class="menu-text"> Par&aacute;metros </span>

								<b class="arrow fa fa-angle-down"></b>
							</a>
						</li>

						<li class="disabled">
							<a href="#" class="dropdown-toggle" title="Funcionalidad por implementar">
								<i class="fa fa-gears"></i>
								<span class="menu-text"> Configuraci&oacute;n </span>

								<b class="arrow fa fa-angle-down"></b>
							</a>							
						</li>

						<li  class="disabled">
							<a href="#" title="Funcionalidad por implementar">
								<i class="fa fa-flag"></i>
								<span class="menu-text"> Cierres </span>

							</a>
						</li>
					</ul><!-- /.nav-list -->

					<div class="sidebar-collapse" id="sidebar-collapse">
						<i class="fa fa-angle-double-left" data-icon1="fa fa-angle-double-left" data-icon2="fa fa-angle-double-right"></i>
					</div>

					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
					</script>
				</div>

				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="fa fa-home home-icon"></i>								
								<a href='/' th:href="@{/}">Inicio</a>
							</li>
							<li>
								<a href="#">Contabilidad</a>
							</li>
							<li class="active">Tipo de Cambio</li>
						</ul><!-- .breadcrumb -->
					</div>
					<div class="page-content">
						<div class="page-header">
							<h1>
								Tipo de Cambio
								<small>
									<i class="fa fa-angle-double-right"></i>
									Mantenimiento de tipo de cambio por fechas
								</small>
							</h1>
						</div><!-- /.page-header -->

						<div th:if="${alertErrorUpdate} or ${alertErrorRegistro}" class="alert alert-danger col-xs-8">
							<button type="button" class="close" data-dismiss="alert">
								<i class="fa fa-times"></i>
							</button>
							<strong>
								<i class="fa fa-times"></i>
								Error al actualizar registro!
							</strong>
							<span th:if="${alertErrorUpdate}">Revisa que los campos sean correctos y la fecha corresponda a la &uacute;ltima o primera fecha de mes.</span>
							<span th:if="${alertErrorRegistro}">Revisa que los campos sean correctos y la fecha sea posterior a la actual.</span>
							<br/>
						</div>
						
						<div th:if="${alertRegistro} or ${alertUpdate}" class="alert alert-block alert-success col-xs-8">
							<button type="button" class="close" data-dismiss="alert">
								<i class="fa fa-times"></i>
							</button>
							<strong>
								<i class="fa fa-check"></i>
								Registro actualizado!
							</strong>
							<span th:if="${alertUpdate}">Ha modificado exitosamente una fecha de tipo de cambio.</span>
							<span th:if="${alertRegistro}">Ha registrado exitosamente una fecha de tipo de cambio.</span>
							
							<br/>
						</div>

						<div class="row">
									<div class="col-xs-8">
										<div class="table-header">
											Resultados de <span th:text="${modoVisualizacion}">&Uacute;ltimos 500 Tipos de Cambio</span>
										</div>

										<div class="table-responsive">
											<table id="tabla-tipoCambio" class="table table-bordered table-hover">
												<thead>
													<tr>
														<th>
														<i class="fa fa-clock-o bigger-110 hidden-480"></i>
														Fecha
														</th>
														<th>Valor de Venta</th>
														<th>Valor de Compra</th>
														<th>Valor T.C. Fijo</th>
														<th></th>
														<th>Adicionado Por</th>
														<th>Fecha adicion</th>
														<th>MNodificado Por</th>
														<th>Fecha modificacion</th>
													</tr>
												</thead>

												<tbody>
													<tr th:each="tipoCambio : ${listaTC}">
														<td th:text="${#dates.format(tipoCambio.fechaTipoCambio, #messages.msg('date.format'))}">19/12/2013</td>
														<td th:text="${#numbers.formatDecimal(tipoCambio.valorVenta, 2, 2, 'POINT')}">2.779</td>
														<td th:text="${#numbers.formatDecimal(tipoCambio.valorCompra, 2, 2, 'POINT')}">2.782</td>
														<td th:text="${#numbers.formatDecimal(tipoCambio.valorTCFijo, 2, 2, 'POINT')}">2.750</td>														
														<td>
															<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons center">
																<a class="green botonEditar" href="#modal-editarTC" data-toggle="modal" >
																	<i class="fa fa-pencil bigger-130"></i>
																</a>
															</div>

															<div class="visible-xs visible-sm hidden-md hidden-lg">
																<div class="inline position-relative">
																	<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
																		<i class="fa fa-caret-down fa fa-only bigger-120"></i>
																	</button>

																	<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
																		<li>
																			<a href="#" class="tooltip-success" data-rel="tooltip" title="Editar">
																				<span class="green">
																					<i class="fa fa-pencil bigger-120"></i>
																				</span>
																			</a>
																		</li>

																		<li>
																			<a href="#" class="tooltip-error" data-rel="tooltip" title="Eliminar">
																				<span class="red">
																					<i class="fa fa-trash-o bigger-120"></i>
																				</span>
																			</a>
																		</li>
																	</ul>
																</div>
															</div>
														</td>
														<td th:text="${tipoCambio.adicionadoPor}">19/12/2013</td>
														<td th:text="${#dates.format(tipoCambio.fechaAdicion, #messages.msg('date.format'))}">19/12/2013</td>
														<td th:text="${tipoCambio.modificadoPor}">19/12/2013</td>
														<td th:text="${tipoCambio.fechaModificacion} ? ${#dates.format(tipoCambio.fechaModificacion, #messages.msg('date.format'))}">19/12/2013</td>
 												</tr>
												</tbody>
											</table>
										</div>
										<div class="space"></div>
										<form class="form-horizontal" role="form">
											<div class="form-group">
											    <label for="showAdicionadoPor" class="col-sm-2 control-label small center">Adicionado Por</label>
											    <div class="col-sm-3">
											      <input type="text" readonly="readonly" class="col-sm-12" id="showAdicionadoPor"/>
											    </div>
											    <label for="showFechaAdicion" class="col-sm-2 col-sm-offset-1 control-label  small center">Fecha de Adici&oacute;n</label>
											    <div class="col-sm-3">
											      <input type="text" readonly="readonly" class="col-sm-12" id="showFechaAdicion"/>
											    </div>											    
											</div>
											<div class="form-group">
											    <label for="showModificadoPor" class="col-sm-2 control-label small center">Modificado Por</label>
											    <div class="col-sm-3">
											      <input type="text" readonly="readonly" class="col-sm-12" id="showModificadoPor"/>
											    </div>
											    <label for="showFechaModificacion" class="col-sm-2 col-sm-offset-1 control-label  small center">Fecha de Modificaci&oacute;n</label>
											    <div class="col-sm-3">
											      <input type="text" readonly="readonly" class="col-sm-12" id="showFechaModificacion"/>
											    </div>											    
											</div>
										</form>
									</div>
									<div class="col-xs-4">
											<div class="btn-group btn-group-vertical">
																						
												<a href="#modal-nuevoTC" class="btn btn-purple btn-sm" data-toggle="modal">
													<i class="fa fa-plus-circle align-top bigger-125"></i>
													Nuevo Tipo de Cambio
												</a>
												<button data-toggle="dropdown" class="btn btn-default btn-sm dropdown-toggle">
													Modo de Visualizaci&oacute;n
													<i class="fa fa-angle-down icon-on-right"></i>
												</button>

												<ul class="dropdown-menu">
													<li>
														<a href='/mantenerTipoCambio' th:href="@{/mantenerTipoCambio}">Ver &uacute;ltimos 500</a>
													</li>

													<li>
														<a href='/verTodosTC' th:href="@{/verTodosTC}">Ver todos</a>
													</li>
												</ul>	
											</div>
											<div id="modal-nuevoTC" class="modal" tabindex="-1">
													<div class="space"></div>
													<div class="space"></div>
													<div class="space"></div>
<!-- 												<div class="modal-dialog"> -->
													<div class="modal-content col-md-3 col-md-offset-4">
														<form th:action="@{/registrarTipoCambio}" th:object="${tipoCambio}" method="POST">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal">&times;</button>															
																<h4 class="green bigger"><i class="fa fa-usd"></i>
																Agregar Tipo de Cambio</h4>
															</div>
					
															<div class="modal-body overflow-visible">
																<div class="row">				
																	<div class="col-xs-12">				
																		<div class="form-group">
																			<label for="form-field-username">Fecha</label>				
																			<div>
																				<input type="text" class="input-large" id="sdate" name="sdate" role="textbox" th:field="*{fechaTipoCambio}"/>
																			</div>
																		</div>
					
																		<div class="space-4"></div>
					
																		<div class="form-group">
																			<label for="form-field-first">Valor Venta</label>				
																			<div>
																				<input type="text" class="input-large" role="textbox" th:field="*{valorVenta}"/>
																			</div>
																		</div>
																		
																		<div class="space-4"></div>
					
																		<div class="form-group">
																			<label for="form-field-first">Valor Compra</label>				
																			<div>
																				<input type="text" class="input-large" role="textbox" th:field="*{valorCompra}"/>
																			</div>
																		</div>
																		
																		<div class="space-4"></div>
					
																		<div class="form-group">
																			<label for="form-field-first">Valor T.C. Fijo</label>				
																			<div>
																				<input type="text" class="input-large" role="textbox" th:field="*{valorTCFijo}"/>
																			</div>
																		</div>
																	</div>
																</div>
															</div>
					
															<div class="modal-footer">				
																<button type="submit" class="btn btn-sm btn-primary">
																	<i class="fa fa-check"></i>
																	Registrar
																</button>
																
																<button class="btn btn-sm" data-dismiss="modal">
																	<i class="fa fa-times"></i>
																	Cancelar
																</button>
															</div>
														</form>
													</div>
<!-- 												</div> -->
											</div><!-- fin modal -->
											<div id="modal-editarTC" class="modal" tabindex="-1">
													<div class="space"></div>
													<div class="space"></div>
													<div class="space"></div>
<!-- 												<div class="modal-dialog"> -->
													<div class="modal-content col-md-3 col-md-offset-4">
														<form th:action="@{/editarTipoCambio}" th:object="${tipoCambio}" method="POST">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal">&times;</button>															
																<h4 class="green bigger"><i class="fa fa-usd"></i>
																Editar Tipo de Cambio</h4>
															</div>
					
															<div class="modal-body overflow-visible">
																<div class="row">				
																	<div class="col-xs-12">				
																		<div class="form-group">
																			<label>Fecha</label>				
																			<div>
																				<input type="text" id="editarFecha" class="input-large" role="textbox" th:field="*{fechaTipoCambio}" readonly="readonly"/>
																			</div>
																		</div>
					
																		<div class="space-4"></div>
					
																		<div class="form-group">
																			<label for="editarValorVenta">Valor Venta</label>				
																			<div>
																				<input type="text" id="editarValorVenta" class="input-large" role="textbox" th:field="*{valorVenta}"/>
																			</div>
																		</div>
																		
																		<div class="space-4"></div>
					
																		<div class="form-group">
																			<label for="editarValorCompra">Valor Compra</label>				
																			<div>
																				<input type="text" id="editarValorCompra" class="input-large" role="textbox" th:field="*{valorCompra}"/>
																			</div>
																		</div>
																		
																		<div class="space-4"></div>
					
																		<div class="form-group">
																			<label for="editarTCFijo">Valor T.C. Fijo</label>				
																			<div>
																				<input type="text" id="editarTCFijo" class="input-large" role="textbox" th:field="*{valorTCFijo}"/>
																			</div>
																		</div>
																	</div>
																</div>
															</div>
					
															<div class="modal-footer">				
																<button type="submit" class="btn btn-sm btn-primary">
																	<i class="fa fa-check"></i>
																	Modificar
																</button>
																
																<button class="btn btn-sm" data-dismiss="modal">
																	<i class="fa fa-times"></i>
																	Cancelar
																</button>
															</div>
														</form>
													</div>
<!-- 												</div> -->
											</div><!-- fin modal -->

																																	
																				
									</div>
								</div>
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->

				<div class="ace-settings-container" id="ace-settings-container">
					<div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
						<i class="fa fa-cog bigger-150"></i>
					</div>

					<div class="ace-settings-box" id="ace-settings-box">
						<div>
							<div class="pull-left">
								<select id="skin-colorpicker" class="hide">
									<option data-skin="default" value="#438EB9">#438EB9</option>
									<option data-skin="skin-1" value="#222A2D">#222A2D</option>
									<option data-skin="skin-2" value="#C6487E">#C6487E</option>
									<option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
								</select>
							</div>
							<span>&nbsp; Elegir Tema</span>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-navbar" />
							<label class="lbl" for="ace-settings-navbar"> Fijar Men&uacute; Superior</label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-sidebar" />
							<label class="lbl" for="ace-settings-sidebar"> Fijar Men&uacute; Lateral</label>
						</div>
					</div>
				</div><!-- /#ace-settings-container -->
			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="fa fa-angle-double-up fa fa-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->
		
		<script src="../../static/custom/typeahead-bs2.min.js" th:src="@{/static/custom/typeahead-bs2.min.js}"></script>

		<!-- page specific plugin scripts -->

		<script src="../../static/custom/bootstrap-datepicker.min.js" th:src="@{/static/custom/bootstrap-datepicker.min.js}"></script>
		<script src="../../static/custom/jquery.dataTables.min.js" th:src="@{/static/custom/jquery.dataTables.min.js}"></script>
		<script src="../../static/custom/jquery.dataTables.bootstrap.js" th:src="@{/static/custom/jquery.dataTables.bootstrap.js}"></script>		

		<!-- ace scripts -->

		<script src="../../static/custom/ace-elements.min.js" th:src="@{/static/custom/ace-elements.min.js}"></script>
		<script src="../../static/custom/ace.min.js" th:src="@{/static/custom/ace.min.js}"></script>

		<!-- inline scripts related to this page -->
		
		<script type="text/javascript">
		// <![CDATA[

		    jQuery.extend( jQuery.fn.dataTableExt.oSort, {
				"date-uk-pre": function ( a ) {
				    var ukDatea = a.split('/');
				    return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
				},
				
				"date-uk-asc": function ( a, b ) {
				    return ((a < b) ? -1 : ((a > b) ? 1 : 0));
				},
				
				"date-uk-desc": function ( a, b ) {
				    return ((a < b) ? 1 : ((a > b) ? -1 : 0));
				}
			} );
		            
			jQuery(function($) {
				var oTable1 = $('#tabla-tipoCambio').dataTable( {
					"bProcessing": true,
					"aoColumns": [			      
			      	{ "sType": "date-uk" },
			     	 null,
			     	 null,
			     	 null,
				  	{ "bSortable": false },
				  	{"bVisible": false},
				  	{"bVisible": false},
				  	{"bVisible": false},
				  	{"bVisible": false}
				],
				"aaSorting": [[0,'desc']],
				
				} );
				
				$("#tabla-tipoCambio tbody").delegate("tr", "click", function() {
					
					if ( $(this).hasClass('success') ) {
			            $(this).removeClass('success');
			            $('#showAdicionadoPor').val(null);
			            $('#showModificadoPor').val(null);
			            $('#showFechaAdicion').val(null);
			            $('#showFechaModificacion').val(null);
			        }
			        else {
			        	var fechaTC = $("td:eq(0)", this).text();
			        	$('#tabla-tipoCambio tr.success').removeClass('success');
			            $(this).addClass('success');
			            $('#showAdicionadoPor').val(oTable1.fnGetData(this)[5]);
			            $('#showModificadoPor').val(oTable1.fnGetData(this)[6]);
			            $('#showFechaAdicion').val(oTable1.fnGetData(this)[7]);
			            $('#showFechaModificacion').val(oTable1.fnGetData(this)[8]);
			       }
				});
				
				$("body").delegate(".botonEditar", "click", function () {
					$('#editarFecha').val($(this).closest("tr").find("td:eq(0)").text());
					$('#editarValorVenta').val($(this).closest("tr").find("td:eq(1)").text());
					$('#editarValorCompra').val($(this).closest("tr").find("td:eq(2)").text());
					$('#editarTCFijo').val($(this).closest("tr").find("td:eq(3)").text());
				});
				
				//enable datepicker
				$(function() {
				    $( "#sdate" ).datepicker({
				      dateFormat: "dd/mm/yy",
				      autoclose:true
				    });
				  });

				
				//override dialog's title function to allow for HTML titles
				$.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
					_title: function(title) {
						var $title = this.options.title || '&nbsp;'
						if( ("title_html" in this.options) && this.options.title_html == true )
							title.html($title);
						else title.text($title);
					}
				}));
			
				$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('table')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			})
			// ]]>
		</script>
		
	</body>
</html>
